
****************************************************************************************
****************************************************************************************
** TABLE 5
****************************************************************************************
****************************************************************************************
 use "${path}data_table.dta", clear

label var nb_pp_universekwplus "\emph{ClusterTheme}"
label var nb_top10_universekwplus "\emph{Top10ClusterTheme}"
label var nb_top5_universekwplus "\emph{Top5ClusterTheme}"
label var nb_kwplus_w "\emph{ClusterKeywords}"
label var npubs "\emph{Pubs}"
label var citations_new "\emph{Cites}"
label var np_if_3y "\emph{AIF}"
label var top95_ay   "\emph{Top5}"
gen nbpub_with_periph = nbpub_same_labex - nbpub_with_labex_biblio
gen nb_first_with_periph = nb_first_same_labex - nb_first_with_labex_biblio
gen nb_collabpub_with_periph =nb_collabpub_same_labex  - nb_collabpub_with_labex_biblio 
label var nbpub_with_labex_biblio "\emph{PubsCore}"
label var nb_collab_with_labex_biblio "\emph{LinksCore}"
label var nb_first_with_labex_biblio "\emph{NewLinksCore}"
label var nb_collabpub_with_labex_biblio "\emph{CollaborationsCore}"
label var nbpub_with_periph "\emph{PubsPeriph}"
label var nb_collab_with_labex_periph "\emph{LinksPeriph}"
label var nb_first_with_periph "\emph{NewLinksPeriph}"
label var nb_collabpub_with_periph "\emph{CollaborationsPeriph}"
label var nb_collab_same_labex "\emph{Links}"
label var citations_new "\emph{Cites}"
gen age_2010 = age if year ==2010
bys id_20:  egen age_in_2010=max( age_2010)
drop age_2010
gen discipline=0
replace discipline=1 if biologie_fondamentale ==1
replace discipline=2 if recherche_medicale ==1
replace discipline=3 if biologie_appliquee_ecologie ==1
replace discipline=4 if chimie ==1
replace discipline=5 if physique ==1
replace discipline=6 if sciences_univers ==1
replace discipline=7 if sciences_ingenieur ==1
replace discipline=8 if mathematiques ==1
replace discipline=9 if SS ==1
replace discipline=10 if SH ==1
global contr biblio age biologie_fondamentale recherche_medicale biologie_appliquee_ecologie chimie physique sciences_univers sciences_ingenieur mathematiques SS SH

*PANEL A
local regnom "new_rest_biblio2"
eststo clear 
qui eststo:  reghdfe nb_collab_with_labex_biblio treat2  if  id_year==1  & criterion_grade==1   & biblio==1,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe nb_collab_with_labex_periph treat2  if  id_year==1  & criterion_grade==1  & biblio==1,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe np_if_3y treat2   if  id_year==1  & criterion_grade==1   & biblio==1 ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe nb_pp_universekwplus treat2   if  id_year==1  & criterion_grade==1   & biblio==1 ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
esttab,  compress ar2 starlevels(* 0.1 ** 0.05 *** 0.01)  b(%4.3f) se(%4.3f) label   keep(treat2) stats(N clusters ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nose nonotes
esttab using  `regnom',   b(%4.3f) se(%4.3f) ar2 starlevels({$^{*}$} 0.1 {$^{**}$} 0.05 {$^{***}$} 0.01)  tex  label replace keep(treat2) stats(N clusters ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nonotes
eststo clear 
 
*PANEL B
local regnom    "new_rest_nobiblio2"
eststo clear 
qui eststo:  reghdfe nb_collab_with_labex_biblio treat2  if  id_year==1  & criterion_grade==1   & biblio==0,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe nb_collab_with_labex_periph treat2  if  id_year==1  & criterion_grade==1  & biblio==0,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe np_if_3y treat2   if  id_year==1  & criterion_grade==1   & biblio==0 ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
qui eststo:  reghdfe nb_pp_universekwplus treat2   if  id_year==1  & criterion_grade==1   & biblio==0 ,  a( i.discipline#i.year age_in_2010#i.year female_new#i.year  year id_2019) cluster(labexid)  
qui :  estadd ysumm  
qui :  estadd scalar clusters = e(N_clust)
esttab,  compress ar2 starlevels(* 0.1 ** 0.05 *** 0.01)  b(%4.3f) se(%4.3f) label   keep(treat2) stats(N clusters ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nose nonotes
esttab using  `regnom',   b(%4.3f) se(%4.3f) ar2 starlevels({$^{*}$} 0.1 {$^{**}$} 0.05 {$^{***}$} 0.01)  tex  label replace keep(treat2) stats(N clusters ymean r2_a, fmt(%9.0g %9.2g %9.2g  ) labels("Observations" "Number of Clusters" "Mean dep variable" "Adj. R-Square" )) nolegend nonotes
eststo clear 
